<?php

class Application_Form_Ajaximei extends Zend_Form
{
   
    public function init() {
        $translate = new My_Action_Helper_Lang();
        $obj = new Application_Model_Gps();
        
        $this->setName('add_imei');
	$imei= new Zend_Form_Element_Text('imei');
        $imei->setLabel($translate->_('imei'))
	         ->setRequired(true);
               
	$name= new Zend_Form_Element_Text('name');
        $name->setLabel($translate->_('name'))
	         ->setRequired(true);
        
        $submit = new Zend_Form_Element_Button('addimei');
        $submit->setLabel($translate->_('Add'))
               ->setAttrib('class', 'button');
        
        $category = new Zend_Form_Element_Select('category');
        //$category->addMultiOption(0);
        $category->setLabel($translate->_('Category'));
        //массивом передаем значения в select
        foreach ($obj->getAllCategories() as $val) {
            $category->addMultiOption($val['id'], $val['name']);
        }        
	         
        $this->addElements(array($imei, $name, $category, $submit));	         
	$this->setMethod('post');        
    }


}

